<template>
  <div style="text-align: center;">
    <div>
      <canvas ref="qrcode"></canvas>
    </div>
  </div>
</template>
<style>
  canvas{
    width: 200px!important;
    height: 200px!important;
  }
</style>
<script>
import QRCode from 'qrcode';

export default {
  props: {
    address: String,
  },
  data() {
    return {
      openid: '',
    };
  },
  mounted() {
    QRCode.toCanvas(this.$refs.qrcode, this.address, (err) => {
      if (err) {
        console.log(err);
      } else {
        console.log('success');
      }
    });
  },
  beforeUpdate() {
    QRCode.toCanvas(this.$refs.qrcode, this.address, (err) => {
      if (err) {
        console.log(err);
      } else {
        console.log('update', this.address);
      }
    });
  },
  methods: {
  },
};
</script>

